﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AsignarCargoPerfil.aspx.cs" Inherits="AsignarCargoPerfil" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="../../css/estilos.css" rel="stylesheet" />
    <link href="../../css/colorbox/colorbox.css" rel="stylesheet" />
    <script type="text/javascript" src="../../js/jquery-1.9.0.min.js"></script>
    <script type="text/javascript" src="../../js/colorbox/jquery.colorbox.js"></script>
    <script type="text/javascript" src="../../js/GEN_js.js"></script>

    <script type="text/javascript">
        function Validar() {
            if (ValidarCheck() < 1) {
                $('#<%=chkListPerfil.ClientID%>').removeClass("rbl-campos-oblig-sb").addClass("rbl-campos-oblig-cb");
                $("#dvAlerta2").html('Debe seleccionar al menos un Perfil');
                $("#dvAlerta2").css("display", "block");
                $("#fijo").css("height", "50px");
                return false;
            } else {
                $('#chkListPerfil').removeClass("rbl-campos-oblig-sb").addClass("rbl-campos-oblig-cb");
                $("#colorbox, #cboxOverlay").appendTo('form:first');
                AbrirModal('330', '210', true, false, '#yesno', false);
                $('#yesno').css("display", "block");
                return false;
            }
        }

        function ValidarCheck() {
            document.getElementById("<%=chkListPerfil.ClientID%>").childElementCount > 0;
            var CHK = document.getElementById("<%=chkListPerfil.ClientID%>");
            var checkbox = CHK.getElementsByTagName("input");
            var counter = 0;
            for (var i = 0; i < checkbox.length; i++) {
                if (checkbox[i].checked) {
                    counter++;
                }
            }
            return counter;
        }

        function Aceptar() {
            window.parent.location.reload();
        }

    </script>
    <title></title>
</head>
<body>
    <form id="frmFormulario" runat="server">
        <asp:HiddenField runat="server" ID="hdfCargo" />
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td class="titulo-modal">Registro de Grupo</td>
            </tr>
        </table>
        <br />
        <div class="div-box-gris">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td class="txt-campos-int">Cargo</td>
                    <td>
                        <asp:DropDownList runat="server" ID="ddlCargo" class="field_element"></asp:DropDownList></td>
                    <td>
                        <asp:Button ID="btnBuscar" runat="server" Text="Buscar" CssClass="skip" OnClick="btnBuscar_Click" /></td>
                </tr>
            </table>
        </div>
        <br />

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td class="txt-campos-int">Perfil</td>
            </tr>
            <tr>
                <td colspan="2">
                    <div class="div-scrollCheckList" style="overflow: auto">
                        <asp:CheckBoxList ID="chkListPerfil" class="rbl-campos-oblig-sb" runat="server"></asp:CheckBoxList>
                    </div>
                </td>
            </tr>

            <tr align="center">
                <td colspan="2">
                    <br />
                    <asp:Button ID="btnGrabar" runat="server" Text="Grabar" CssClass="skip" OnClientClick="return Validar()" />
                    <input id="btnCancelar" type="button" class="skip" onclick="window.parent.CerrarModal();" value="Cancelar" />
            </tr>
        </table>

        <div id="fijo" runat="server">
            <div class="alertaRegistro alerta" runat="server" style="display: none;" id="dvAlerta2">
            </div>
        </div>

        <div id="yesno" style="display: none">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td class="titulo-modal">Mensaje del Sistema</td>
                </tr>
            </table>
            <br />
            <table width="100%" align="center" border="0" cellspacing="2" cellpadding="1">
                <tr>
                    <td align="center" width="72">
                        <img alt="Interrogación" src="../../images/icon-interrogacion-modal.png" /></td>
                    <td class="" align="center" style="padding-left: 6px; padding-right: 6px;">¿Esta seguro que desea guardar los cambios?</td>
                </tr>
            </table>
            <table width="80%" border="0" align="center" cellspacing="0" cellpadding="0">
                <tr>
                    <td align="center">
                        <asp:Button ID="btnSi" runat="server" CssClass="skip" Text="Si" OnClick="btnSi_Click" />
                        <input id="btnNo" type="button" class="skip" onclick="window.parent.CerrarModal();" value="No" />
                    </td>
                </tr>
            </table>
        </div>

        <div id="confirmacion" style="display: none">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td class="titulo-modal">Mensaje del Sistema</td>
                </tr>
            </table>
            <br />
            <table width="100%" align="center" border="0" cellspacing="2" cellpadding="1">
                <tr>
                    <td align="center" width="72">
                        <img alt="confirmacion" src="../../images/icon-valido.png" /></td>
                    <td class="" align="center" style="padding-left: 6px; padding-right: 6px;">Los datos fueron grabados correctamente.</td>
                </tr>
            </table>
            <table width="80%" border="0" align="center" cellspacing="0" cellpadding="0">
                <tr>
                    <td align="center">
                        <asp:Button ID="btnAceptar" runat="server" CssClass="skip" Text="Aceptar" OnClientClick="Aceptar();" />
                    </td>
                </tr>
            </table>
        </div>
    </form>
</body>
